import http from '../utils/http'; 
import axios from 'axios';

 /* 
 @returns {Promise<any>}
 */
export const $updateStockHistory = async () => {
    try {
        const res = await http.get('api/predict/update', { timeout: 360000 }); // 设置超时时间
        if (res.code !== 0) {
            throw new Error(res.data.message || '更新股票数据失败');
        }
        return res.data;
    } catch (err) {
        if (err.code === 'ECONNABORTED') {
            throw new Error('请求超时，请稍后再试');
        }
        throw new Error(`更新股票数据失败: ${err.message}`);
    }
};
